<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0, maximum-scale=1.0"/>
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.4.0/css/font-awesome.min.css">
  <link rel="stylesheet" href="css/froala_editor.css">
  <link rel="stylesheet" href="css/froala_style.css">
  <link rel="stylesheet" href="css/plugins/code_view.css">
  <link rel="stylesheet" href="css/plugins/draggable.css">
  <link rel="stylesheet" href="css/plugins/colors.css">
  <link rel="stylesheet" href="css/plugins/emoticons.css">
  <link rel="stylesheet" href="css/plugins/image_manager.css">
  <link rel="stylesheet" href="css/plugins/image.css">
  <link rel="stylesheet" href="css/plugins/line_breaker.css">
  <link rel="stylesheet" href="css/plugins/table.css">
  <link rel="stylesheet" href="css/plugins/char_counter.css">
  <link rel="stylesheet" href="css/plugins/video.css">
  <link rel="stylesheet" href="css/plugins/fullscreen.css">
  <link rel="stylesheet" href="css/plugins/file.css">
  <link rel="stylesheet" href="css/plugins/quick_insert.css">
  <link rel="stylesheet" href="css/plugins/help.css">
  <link rel="stylesheet" href="css/third_party/spell_checker.css">
  <link rel="stylesheet" href="css/plugins/special_characters.css">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.3.0/codemirror.min.css">

  <link href="../js/plugins/webuploader/webuploader.css" rel="stylesheet">
  <link href="../js/plugins/webuploader/style.css" rel="stylesheet">


  <link href="../css/bootstrap.min14ed.css?v=3.3.6" rel="stylesheet">
  <link href="../css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">

  <link href="../css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
  <link href="../css/animate.min.css" rel="stylesheet">
  <link href="../css/style.min862f.css?v=4.1.0" rel="stylesheet">

  <link rel="stylesheet" href="../css/cropper.min.css">
  <link rel="stylesheet" href="../css/ImgCropping.css">

  <style>
      body {
          text-align: center;
      }
      input{  
        background:none;  
        outline:none;  
        border:0px;
      }
      div#editor {
          width: 81%;
          margin: auto;
          text-align: left;
      }
      /* 样式重写 */
      .fr-wrapper{
        min-height: 500px!important;
      }
      .fr-wrapper > div[style*='z-index: 9999'] {
           position: absolute;
           top: -10000px;
           opacity: 0;
       }
      .fr-box.fr-basic .fr-element {
          margin-top: 0px;
      }

      #artcleName > input{
        width: 100%;
        height: 46px;
        font-size: 24px;
      }
      #authorName > input{
        width: 100%;
        height: 22px;
        font-size: 16px;
      }
      .draftWarp{
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.8);
        position: fixed;
        top: 0;
        display: flex;
        align-items: center;
      }
      .none{
        display: none!important;
      }
      #editCover{
        display: none;
        width: 100%;
        position: absolute!important;
        top: 0!important;
        z-index: 999!important;
        padding: 15px 15px;
        margin: 15px 0;
        background-color: #fafafa;
        box-shadow: inset 0 3px 6px rgba(0, 0, 0, .05);
        border-color: #e5e5e5 #eee #eee;
        border-style: solid;
        border-width: 1px 0;
        min-width: 325px;
      }
      #editCover .wrapper{
        text-align: center;
        border: 3px dashed #ccc;
        /* background: url(../images/image.png) center 93px no-repeat; */
        color: #cccccc;
        font-size: 18px;
        position: relative;
        padding: 0 20px;
      }
  </style>
</head>

<body class="gray-bg">
  <div class="wrapper wrapper-content  animated fadeInRight">
      <div class="row">
        <div class="col-sm-12">
          <div class="ibox ">
            <div class="ibox-title p30 w100p">
              <div class="pull-left w100p f18 pd10 ">
                <div class="pull-left pd10 bd_9db3c0 w100p">
                  <span class="back_span pull-left"><a onClick="javascript :history.go(-1);" class="c0">返回</a></span>
                  <i class="fa fa-angle-left pl10 pull-left" style="margin-top: 4px;"></i>
                  <span class="c_5bb7ee pl10 pull-left">新建商品</span>
                </div>
              </div>
              <form class="form-horizontal m-t" enctype="multipart/form-data" method="post" id="add_shop_form">
                <input type="hidden" class="token_input" name="token" id="token" value="" />
								<input type="hidden" class="sysUserId_input" name="sysUserId" value="" />
								<input type="hidden" id="region" name="region" value=""/>

                
                <article class="page-container"  style="margin-left:25px;">
                  <input type="hidden" name="id" id="goodId" value=""/>
                  <div class="row cl" >
                    <div class="form-group ">
                      <label class="col-sm-2 control-label pull-left"><span class="pull-left">*商品名称：</span></label>
                      <div class="col-sm-8 pull-left" id="articleTitle">
                          <input type="text" class="form-control" name="title" aria-required="true" class="input-text" placeholder="输入商品名称">
                      </div>
                    </div>
                    <div class="form-group " >
                        <label class="col-sm-2 control-label pull-left"><span class="pull-left">*上传封面：</span></label>
                      <div id="replaceImg" style="width: 100px;height: 100px;background: #eee;overflow:hidden;position: relative;left: 15px;">
                        <img id="finalImg" src="" width="100%">
                        <input type="hidden" class="get_imgurl" name="albumPics" value="" />
                      </div>
                    </div>

                    <div class="form-group ">
                      <label class="col-sm-2 control-label pull-left"><span class="pull-left">*销售价：</span></label>
                      <div class="col-sm-2 pull-left" id="articleTitle">
                          <input type="text" class="form-control" name="originalPrice" aria-required="true" class="input-text">
                      </div>
                    </div>
     
                    <div class="form-group ">
                      <label class="col-sm-2 control-label pull-left"><span class="pull-left">*描述：</span></label>
                      <input type="hidden" class="get_description" name="description" value="" />
                    </div>                
                    <div id="edit"></div>


                  </div>
                  
                  <div class="row cl" style="margin:50px 0;">
                    <div class="col-xs-8 col-sm-7 col-xs-offset-4 col-sm-offset-3">
                      <input class="btn btn-primary radius ml10 addGood" type="button" data-fabustyle="0" value="&nbsp;&nbsp;保存&nbsp;&nbsp;">
                      <input class="btn btn-primary radius ml10 cancel" type="button" value="&nbsp;&nbsp;取消&nbsp;&nbsp;">
                    </div>
                  </div>

                </article>
              
              
              
              </form>
              

              
            </div>

          </div>
        </div>
      </div>
    </div>

  <div class="none draftWarp">
    <div style="width: 450px;height: 828px;margin:0 auto;display:flex;flex-direction: column;background: #fff;">
      <div class="col-sm-6" style="width:436px;height: 728px;background:#fff;margin: 0 auto;">
        <div class="pull-left" id="articleViewAreaTit" style="width: 100%;height: 48px;margin-top:20px;"></div>
        <div class="pull-left" id="articleViewAreaCont" style="width: 100%;height: 48px;margin-top:20px;"></div>
      </div>
      <div class="closeWarp" onclick="closeWarp()" style="width: 100px;height: 50px;line-height:50px;margin: 30px auto;border-radius: 4px;border: 1px solid #676a6c;">关闭</div>
    </div>
    
  </div>
  <!--图片裁剪框 start-->
  <div style="display: none;z-index: 9999;" class="tailoring-container">
    <div class="black-cloth" onclick="closeTailor(this)"></div>
    <div class="tailoring-content">
        <div class="tailoring-content-one">
          <label title="上传图片" for="chooseImg" class="l-btn choose-btn">
            <input type="file" accept="image/jpg,image/jpeg,image/png" name="file" id="chooseImg" class="hidden" onchange="selectImg(this)">
            选择图片
          </label>
          <div class="close-tailoring"  onclick="closeTailor(this)">×</div>
        </div>
        <div class="tailoring-content-two">
          <div class="tailoring-box-parcel">
            <img id="tailoringImg">
          </div>
          <div class="preview-box-parcel">
            <p>图片预览：</p>
            <div class="square previewImg"></div>
            <div class="circular previewImg"></div>
          </div>
        </div>
        <div class="tailoring-content-three">
          <button class="l-btn cropper-reset-btn">复位</button>
          <button class="l-btn cropper-rotate-btn">旋转</button>
          <button class="l-btn cropper-scaleX-btn">换向</button>
          <button class="l-btn sureCut" id="sureCut">确定</button>
        </div>
      </div>
  </div>
  <!--加载遮罩组件-->
  <div class="none" id="wating_show">
    <div class="ibox wating_big_div">
        <div class="zhezhao bg_f"></div>
        <div class="ibox-content wating_content_div " >
            <div class="spiner-example">
                <div class="sk-spinner sk-spinner-wave">
                    <div class="sk-rect1"></div>
                    <div class="sk-rect2"></div>
                    <div class="sk-rect3"></div>
                    <div class="sk-rect4"></div>
                    <div class="sk-rect5"></div>
                </div>
                <h5 class="f20 c0" ><span id="loading_text">正在请求 ，请稍后...... </span>(<span id="second_span">0</span>)秒</h5>
            </div>
        </div>
    </div>
  </div>

  <script src="../js/jquery.min.js?v=2.1.4"></script>
  <script src="../js/jquery-2.1.0.js" type="text/javascript" charset="utf-8"></script>
  <script src="../js/plugins/peity/jquery.peity.min.js"></script>
  <script src="../js/content.min.js?v=1.0.0"></script>
  <script src="../js/plugins/layer/laydate/laydate.js"></script>
  <script src="../js/plugins/sweetalert/sweetalert.min.js"></script>
  <script src="../js/common.js" type="text/javascript" charset="utf-8"></script>
  <script src="../js/jquery-form.js" type="text/javascript" charset="utf-8"></script>

  <script src="../js/plugins/webuploader/webuploader.support.js"></script>
  <script src="../js/plugins/webuploader/webuploader.js"></script>


  <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
  <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.3.0/codemirror.min.js"></script>
  <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.3.0/mode/xml/xml.min.js"></script>

  <script type="text/javascript" src="js/froala_editor.min.js" ></script>
  <script type="text/javascript" src="js/plugins/align.min.js"></script>
  <script type="text/javascript" src="js/plugins/char_counter.min.js"></script>
  <script type="text/javascript" src="js/plugins/code_beautifier.min.js"></script>
  <script type="text/javascript" src="js/plugins/code_view.min.js"></script>
  <script type="text/javascript" src="js/plugins/colors.min.js"></script>
  <script type="text/javascript" src="js/plugins/draggable.min.js"></script>
  <script type="text/javascript" src="js/plugins/emoticons.min.js"></script>
  <script type="text/javascript" src="js/plugins/entities.min.js"></script>
  <script type="text/javascript" src="js/plugins/file.min.js"></script>
  <script type="text/javascript" src="js/plugins/font_size.min.js"></script>
  <script type="text/javascript" src="js/plugins/font_family.min.js"></script>
  <script type="text/javascript" src="js/plugins/fullscreen.min.js"></script>
  <script type="text/javascript" src="js/plugins/image.min.js"></script>
  <script type="text/javascript" src="js/plugins/image_manager.min.js"></script>
  <script type="text/javascript" src="js/plugins/line_breaker.min.js"></script>
  <script type="text/javascript" src="js/plugins/inline_style.min.js"></script>
  <script type="text/javascript" src="js/plugins/link.min.js"></script>
  <script type="text/javascript" src="js/plugins/lists.min.js"></script>
  <script type="text/javascript" src="js/plugins/paragraph_format.min.js"></script>
  <script type="text/javascript" src="js/plugins/paragraph_style.min.js"></script>
  <script type="text/javascript" src="js/plugins/quick_insert.min.js"></script>
  <script type="text/javascript" src="js/plugins/quote.min.js"></script>
  <script type="text/javascript" src="js/plugins/table.min.js"></script>
  <script type="text/javascript" src="js/plugins/save.min.js"></script>
  <script type="text/javascript" src="js/plugins/url.min.js"></script>
  <script type="text/javascript" src="js/plugins/video.min.js"></script>
  <script type="text/javascript" src="js/plugins/help.min.js"></script>
  <script type="text/javascript" src="js/plugins/print.min.js"></script>
  <script type="text/javascript" src="js/third_party/spell_checker.min.js"></script>
  <script type="text/javascript" src="js/plugins/special_characters.min.js"></script>
  <script type="text/javascript" src="js/plugins/word_paste.min.js"></script>
  <script type="text/javascript" src="js/languages/zh_cn.js"></script>

  <script src="../js/cropper.min.js"></script>
  

  <script>
    var tableTimeout,addManageTimeout,setPowerTime,editManageTimeout,deleteTimeOut,getPowerTime,limits = 20,page = 1,counts = 0,table_title,roleID;
    var roleObj;
    var r_userUrl;
    var r_userName;

    var goodId = '';
    var apiUrl = '';
    var ajaxType = '';
    $(function (){
      IsTokenSave();
      //用户头像上传部分：弹出框水平垂直居中
      var win_height = $(window).height();
      var win_width = $(window).width();
      if (win_width <= 768){
        $(".tailoring-content").css({
          "top": (win_height - $(".tailoring-content").outerHeight())/2,
          "left": 0
        });
      }else{
        $(".tailoring-content").css({
          "top": (win_height - $(".tailoring-content").outerHeight())/2,
          "left": (win_width - $(".tailoring-content").outerWidth())/2
        });
      }
      //判断 新增商品 或 编辑
      goodId = getURLParams(document.URL).id;
      console.log(goodId);

      if(goodId != undefined){
        console.log('编辑');
        $("#goodId").val(goodId);
        getProduct(goodId);
        apiUrl = common_url.pmsProduct_edit;
        ajaxType = "put";
      }else{
        console.log('新建')
        apiUrl = common_url.pmsProduct_add;
        ajaxType = "post";
        // initFroalaEditor(editContent);
        // getarticleTags();
        // userInfoPager();
        // initWebUploader();
        var editContent = '';
        initFroalaEditor(editContent);
      }

    
    })
    /**
			 * 该方法用于初始化列表
			 * @param {Number} startIndex startIndex是数据起始下标
    **/
    function getProduct (goodId) {
      Showload("正在初始化列表......");
      tableTimeout = setInterval("Timeout(tableTimeout)", 1000);
      $.ajax({
        type:"get",
        url:urls+ common_url.pmsProduct_getProduct,
        async:true,
        timeout:30000,
        dataType:"json",
        headers:{
          'X-Access-Token':userMessage.token,
        },
        data:{
          id:goodId
        },
        success:function  (json) {
          console.log(json);
          CheckLogout (json);//检查是否登陆过期
          if (json.code == 200) {
            var myData = json.result;
            console.log(myData);
            initFroalaEditor(myData.description);
            $("#add_shop_form .form-control").eq(0).val(myData.title);
            $("#finalImg").attr('src',imgUrl+myData.albumPics);
            $("#add_shop_form .form-control").eq(1).val(myData.originalPrice);
            // getarticleTags(myData.tagId);
            // userInfoPager(myData.userId);
            // initWebUploader();
            // $("#articleTitle input").val(myData.articleTitle);

            // if(myData.coverUrl != null){
            //   $("#editCover").css("display","block");
            //   var tableHtml = "";
            //   tableHtml = tableHtml + '<div class="file-item thumbnail" id="WU_FILE_0" style="width: 150px; height: 150px;">'
            //           +'<div class="file-info">'+ myData.coverUrl +'</div>'
            //           +'<div class="file-operations"><div class="file-delete"><button id="editD" data-url="'+ myData.coverUrl +'" onclick="editDelCover()" type="button">删除</button></div><div class="file-retry"><button type="button">重试</button></div></div>'
            //           +'<div class="progress" style="display:none;"><div class="progress-bar" style="width: 100%;"></div></div>'
            //           +'<div class="state success">上传成功</div>'
            //           +'<input type="hidden" class="picurl" value="'+ myData.coverUrl +'">'
            //           +'<img src="'+ myData.coverUrl +'">'
						// 				+ '</div>';
            //   $("#editFile").html(tableHtml)
            // }

        

          } else{
            if (json.return_msg == "Session过期") {
              window.location = "login_timeout.html";
            }else{
              TipsAlert(json.return_msg);
            }
          }

          InitTime (tableTimeout);
        },
        error:function(xml, text, errorThrown) {
          if (text == "timeout") {
            TipsAlert("请求超时,请检查网络或着重新打开该页面.");
          } else{
            TipsAlert("请求数据失败,请联系后台技术人员");
          }
          InitTime (tableTimeout);
        }
        
      });
    }
			

    //用户头像上传部分：弹出图片裁剪框
    $("#replaceImg").on("click",function () {
      $(".tailoring-container").toggle();
    });
    //图像上传
    function selectImg(file) {
      if (!file.files || !file.files[0]){
        return;
      }
      var reader = new FileReader();
      reader.onload = function (evt) {
        var replaceSrc = evt.target.result;
        //更换cropper的图片
        $('#tailoringImg').cropper('replace', replaceSrc,false);//默认false，适应高度，不失真
      }
      reader.readAsDataURL(file.files[0]);
    }
    //cropper图片裁剪
    $('#tailoringImg').cropper({
      aspectRatio: 1/1,//默认比例
      preview: '.previewImg',//预览视图
      guides: false,  //裁剪框的虚线(九宫格)
      autoCropArea: 0.5,  //0-1之间的数值，定义自动剪裁区域的大小，默认0.8
      movable: false, //是否允许移动图片
      dragCrop: true,  //是否允许移除当前的剪裁框，并通过拖动来新建一个剪裁框区域
      movable: true,  //是否允许移动剪裁框
      resizable: true,  //是否允许改变裁剪框的大小
      zoomable: false,  //是否允许缩放图片大小
      mouseWheelZoom: false,  //是否允许通过鼠标滚轮来缩放图片
      touchDragZoom: true,  //是否允许通过触摸移动来缩放图片
      rotatable: true,  //是否允许旋转图片
      crop: function(e) {
        // 输出结果数据裁剪图像。
      }
    });
    //旋转
    $(".cropper-rotate-btn").on("click",function () {
      $('#tailoringImg').cropper("rotate", 45);
    });
    //复位
    $(".cropper-reset-btn").on("click",function () {
      $('#tailoringImg').cropper("reset");
    });
    //换向
    var flagX = true;
    $(".cropper-scaleX-btn").on("click",function () {
      if(flagX){
        $('#tailoringImg').cropper("scaleX", -1);
        flagX = false;
      }else{
        $('#tailoringImg').cropper("scaleX", 1);
        flagX = true;
      }
      flagX != flagX;
    });

    //裁剪后的处理
    $("#sureCut").on("click",function () {
      if ($("#tailoringImg").attr("src") == null ){
        return false;
      }else{
        var cas = $('#tailoringImg').cropper('getCroppedCanvas');//获取被裁剪后的canvas
        var base64url = cas.toDataURL('image/png'); //转换为base64地址形式
        $("#finalImg").prop("src",base64url);//显示为图片的形式
        // console.log(base64url);
        $(".get_imgurl").val(base64url);

        // var appPicurl;
        // $.ajax({
        // 	type:"post",
        // 	url:"http://192.168.31.199:8280/yy-admin/oss/myUpload",
        // 	async:true,
        // 	timeout:30000,
        // 	dataType:"json",
        // 	headers:{
        // 		'X-Access-Token':userMessage.token,
        // 	},
        // 	data:{
        // 		file:base64url,
        // 	},
        // 	success:function(json) {
        // 		console.log(json)
        // 		appPicurl = imgUrl + json.result;
        // 		$(".get_imgurl").val(appPicurl);
        // 	},
        // 	error:function (xml,text,e) {
          
        // 	}
        // });	

        //关闭裁剪框
        closeTailor();
      }
    });
    //关闭裁剪框
    function closeTailor() {
      $(".tailoring-container").toggle();
    }

 

    //初始化富文本调用的froalaEditor插件
    function initFroalaEditor(editContent){
      //超大屏幕的功能按钮
      var toolbarButtons   = ['fullscreen', 'bold', 'italic', 'underline', 'strikeThrough', 'subscript', 'superscript', 'fontFamily', 'fontSize', '|', 'color', 'emoticons', 'inlineStyle', 'paragraphStyle', '|', 'paragraphFormat', 'align', 'formatOL', 'formatUL', 'outdent', 'indent', 'quote', 'insertHR', '-', 'insertLink', 'insertImage', 'insertVideo', 'insertFile', 'insertTable', 'undo', 'redo', 'clearFormatting', 'selectAll', 'html'];
      //大屏幕的功能按钮
      var toolbarButtonsMD = ['fullscreen', 'bold', 'italic', 'underline', 'fontFamily', 'fontSize', 'color', 'paragraphStyle', 'paragraphFormat', 'align', 'formatOL', 'formatUL', 'outdent', 'indent', 'quote', 'insertHR', 'insertLink', 'insertImage', 'insertVideo', 'insertFile', 'insertTable', 'undo', 'redo', 'clearFormatting'];
      //小屏幕的功能按钮
      var toolbarButtonsSM = ['fullscreen', 'bold', 'italic', 'underline', 'fontFamily', 'fontSize', 'insertLink', 'insertImage', 'insertTable', 'undo', 'redo'];
      //手机的功能按钮
      var toolbarButtonsXS = ['bold', 'italic', 'fontFamily', 'fontSize', 'undo', 'redo'];
      //var pid = $('#pid').val();

      //编辑器初始化并赋值
      $('#edit').on('froalaEditor.initialized', function (e, editor) {
          $('#edit').froalaEditor('html.set',editContent);

      })
      .froalaEditor({
          placeholderText: '请输入文章内容', //默认填充内容
          charCounterCount       : true,//默认 显示字数
          saveInterval           : 0,//不自动保存，默认10000，0为不自动保存
          //theme                  : "dark",//主题：dark，red，gray，royal，注意需要引入对应主题的css
          height                  : "400px",
          toolbarBottom           : false,//默认
          toolbarButtonsMD        : toolbarButtonsMD,
          toolbarButtonsSM        : toolbarButtonsSM,
          toolbarButtonsXS        : toolbarButtonsXS,
          toolbarInline           : false,//true选中设置样式,默认false
          imageUploadMethod       : 'POST',
          heightMin: 450,
          charCounterMax: 3000,  //最大字数限制，-1为不限制
          saveURL: '${ctx}/webmana/article/saveArticle',  //自动保存的地址（body参数为html内容）
          saveParams: { postId: '1'},  //保存内容时传的参数
          // spellcheck: false,  //是否允许浏览器对输入内容进行拼写检查
          imageUploadURL: 'http://47.107.248.102:8281/yy-admin/oss/upload',//上传到本地服务器
          imageUploadParams: {isPin: 1}, //上传图片时带的参数
          ///imageDefaultWidth: 100, //上传图片后的默认大小
          //imageResizeWithPercent: true,//不设置这个，imageDefaultWidth的单位为像素，设置后为%
          videoUploadURL:'${ctx}/webmana/attachment/uploadArticleVideo',
          enter: $.FroalaEditor.ENTER_BR, //设置回车键功能
          language: 'zh_cn',
          // toolbarButtons: ['bold', 'italic', 'underline', 'paragraphFormat', 'align','color','fontSize','insertImage','insertTable','undo', 'redo']
      });
    }
    
    

    $(".addGood").click(function() { //保存
      var html=$('#edit').froalaEditor('html.get', true); //返回富文本编辑里面的html代码
      $(".get_description").val(html);
      console.log(userMessage.userInfo.id)
      $(".sysUserId_input").val(userMessage.userInfo.id);

      if(goodId != undefined){
        console.log('编辑');
      }else{
        console.log('新建')
        if ($("#add_shop_form .form-control").eq(0).val().trim() == "") {
          TipsAlert("请输入商品名称！");
          return false;
        }
        if ($("#add_shop_form .get_imgurl").eq(0).val().trim() == "") {
          TipsAlert("请上传商品封面！");
          return false;
        }
        if ($("#add_shop_form .form-control").eq(1).val().trim() == "") {
          TipsAlert("请输入销售价格！");
          return false;
        }
        
        if (html == "") {
          TipsAlert("请输入商品描述！");
          return false;
        }
      }
					
      
      
      


      console.log($("#add_shop_form").serialize());
      Showload("正在初始化列表......");
      addManageTimeout = setInterval("Timeout(addManageTimeout)", 1000);
      $.ajax({
        type:ajaxType,
        url:urls+ apiUrl,
        async:true,
        timeout:30000,
        dataType:"json",
        headers:{
          'X-Access-Token':userMessage.token,
        },
        data:$("#add_shop_form").serialize(),
        success:function  (json) {
          CheckLogout (json);//检查是否登陆过期
          if (json.code == 200) {
            swal({
                title: "添加成功",
                text: "添加成功",
                type: "success",
            },function () {
              // location.reload();
              history.go(-1);
            });
          } else{
            TipsAlert(json.return_msg);
          }
          InitTime (addManageTimeout);
        },
        error:function(xml, text, errorThrown) {
          if (text == "timeout") {
            TipsAlert("请求超时,请检查网络或着重新打开该页面.");
          } else{
            TipsAlert("请求数据失败,请联系后台技术人员");
          }
          InitTime (addManageTimeout);
        }
        
      });

    });
    $(".cancel").click(function(){
      history.go(-1);
    });

    
   
   
    
    
  </script>
</body>
</html>